<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="Hexo Theme Redefine">
    
    <meta name="author" content="The局外人">
    <!-- preconnect -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    
    
    <!--- Seo Part-->
    
    <link rel="canonical" href="https://dragon-xjy.atomgit.net/personal/2024/05/14/简单又实用的css小技巧/"/>
    <meta name="robots" content="index,follow">
    <meta name="googlebot" content="index,follow">
    <meta name="revisit-after" content="1 days">
    
        <meta name="description" content="CSS是网页设计的重要组成部分，负责网页的样式和布局， 大约有上百个属性，本文分享一些有用的 CSS 小技巧，方便开发者和设计师参考，一起来看看吧~~~ firlter用法filter(滤镜)通常用于调整图像、背景和边框的渲染。 图片置灰1filter: grayscale(100%);  滤镜阴影1filter: drop-shadow(10px 10px 10px rgba(0,0,0,0.8">
<meta property="og:type" content="article">
<meta property="og:title" content="简单又实用的CSS小技巧！">
<meta property="og:url" content="https://dragon-xjy.atomgit.net/personal/2024/05/14/%E7%AE%80%E5%8D%95%E5%8F%88%E5%AE%9E%E7%94%A8%E7%9A%84CSS%E5%B0%8F%E6%8A%80%E5%B7%A7/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="CSS是网页设计的重要组成部分，负责网页的样式和布局， 大约有上百个属性，本文分享一些有用的 CSS 小技巧，方便开发者和设计师参考，一起来看看吧~~~ firlter用法filter(滤镜)通常用于调整图像、背景和边框的渲染。 图片置灰1filter: grayscale(100%);  滤镜阴影1filter: drop-shadow(10px 10px 10px rgba(0,0,0,0.8">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://dragon-xjy.atomgit.net/personal/image/css/image1.png">
<meta property="og:image" content="https://dragon-xjy.atomgit.net/personal/image/css/image2.png">
<meta property="og:image" content="https://dragon-xjy.atomgit.net/personal/image/css/image3.png">
<meta property="og:image" content="https://dragon-xjy.atomgit.net/personal/image/css/image4.png">
<meta property="og:image" content="https://dragon-xjy.atomgit.net/personal/image/css/image5.png">
<meta property="article:published_time" content="2024-05-14T03:43:01.306Z">
<meta property="article:modified_time" content="2023-09-03T14:18:25.706Z">
<meta property="article:author" content="John Doe">
<meta property="article:tag" content="前端">
<meta property="article:tag" content="CSS">
<meta property="article:tag" content="实用">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://dragon-xjy.atomgit.net/personal/image/css/image1.png">
    
    
    <!--- Icon Part-->
    <link rel="icon" type="image/png" href="https://dragon-xjy.gitee.io/resource/blog/logo.jpg" sizes="192x192">
    <link rel="apple-touch-icon" sizes="180x180" href="https://dragon-xjy.gitee.io/resource/blog/logo.jpg">
    <meta name="theme-color" content="#A31F34">
    <link rel="shortcut icon" href="https://dragon-xjy.gitee.io/resource/blog/logo.jpg">
    <!--- Page Info-->
    
    <title>
        
            简单又实用的CSS小技巧！ -
        
        XieJinYangの博客
    </title>
    
<link rel="stylesheet" href="/personal/css/style.css">


    
        
<link rel="stylesheet" href="/personal/css/build/styles.css">

    

    
<link rel="stylesheet" href="/personal/fonts/fonts.css">

    
<link rel="stylesheet" href="/personal/fonts/Satoshi/satoshi.css">

    
<link rel="stylesheet" href="/personal/fonts/Chillax/chillax.css">

    <!--- Font Part-->
    
    
    
        <link href="" rel="stylesheet">
    
    

    <!--- Inject Part-->
    
    <script id="hexo-configurations">
    let Global = window.Global || {};
    Global.hexo_config = {"hostname":"dragon-xjy.atomgit.net","root":"/personal/","language":"zh-CN","path":"search.xml"};
    Global.theme_config = {"articles":{"style":{"font_size":"16px","line_height":1.5,"image_border_radius":"14px","image_alignment":"center","image_caption":false,"link_icon":false},"word_count":{"enable":true,"count":true,"min2read":true},"author_label":{"enable":true,"auto":false,"list":["Lv Max"]},"code_block":{"copy":true,"style":"mac","font":{"enable":false,"family":null,"url":null}},"toc":{"enable":true,"max_depth":3,"number":true,"expand":true,"init_open":true},"copyright":true,"lazyload":true,"recommendation":{"enable":false,"title":"推荐阅读","limit":3,"mobile_limit":2,"placeholder":"/images/wallhaven-wqery6-light.webp","skip_dirs":["/photo/"]}},"colors":{"primary":"#A31F34","secondary":null},"global":{"fonts":{"chinese":{"enable":true,"family":null,"url":null},"english":{"enable":false,"family":null,"url":null}},"content_max_width":"1000px","sidebar_width":"210px","hover":{"shadow":true,"scale":false},"scroll_progress":{"bar":false,"percentage":true},"website_counter":{"url":"https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js","enable":true,"site_pv":true,"site_uv":true,"post_pv":true},"single_page":true,"open_graph":true,"google_analytics":{"enable":false,"id":null}},"home_banner":{"enable":true,"style":"fixed","image":{"light":"/images/light.jpg","dark":"/images/dark.png"},"title":"Personal blog","subtitle":{"text":["冰冻三尺非一日之寒","成大事者不拘小节"],"hitokoto":{"enable":false,"api":"https://v1.hitokoto.cn"},"typing_speed":100,"backing_speed":80,"starting_delay":500,"backing_delay":1500,"loop":true,"smart_backspace":true},"text_color":{"light":"#fff","dark":"#d1d1b6"},"text_style":{"title_size":"2.8rem","subtitle_size":"1.5rem","line_height":1.2},"custom_font":{"enable":false,"family":null,"url":null},"social_links":{"enable":true,"links":{"git":null,"fa-solid fa-user":"https://juejin.cn/user/1368213338982584","zhihu":null,"twitter":null,"email":"1821741004@qq.com"},"qrs":{"weixin":null}}},"plugins":{"feed":{"enable":false},"aplayer":{"enable":true,"type":"fixed","audios":[{"name":"7 Years","artist":"Lukas Graham","url":"https://dragon-xjy.gitee.io/resource/blog/c73b_cfbf_19df_d571e9501faef5e87a88caba137683ac.mp3","cover":"https://p1.music.126.net/-YNAznLwWX5jtyKexvAGEg==/109951164513163702.jpg"},{"name":"Beijing","artist":"接个吻，开一枪","url":"https://dragon-xjy.gitee.io/resource/blog/e8b8_eb80_50dc_72268dcc92f93e1bca64106756d652cb.mp3","cover":"https://p1.music.126.net/kXdnUtl-eVQcA15xDlSZWg==/109951163859434668.jpg?param=130y130"},{"name":"Something Just Like This","artist":"Coldplay","url":"https://evan.beee.top/music/Something%20Just%20Like%20This%20-%20The%20Chainsmokers%E3%80%81Coldplay.mp3","cover":"https://evan.beee.top/music/covers/Something_Just_Like_This.png"},{"name":"江山水意","artist":"九鸢Music","url":"https://dragon-xjy.gitee.io/resource/blog/%E6%B1%9F%E5%B1%B1%E6%B0%B4%E6%84%8F.mp3","cover":"https://p2.music.126.net/xJPohJAxnAViLo4IVk4Gmg==/109951163635180376.jpg?param=130y130"},{"name":"洪荒之力","artist":"Hoaprox","url":"https://dragon-xjy.gitee.io/resource/blog/705872029.mp3","cover":"https://p2.music.126.net/rtsE3wyy32vN3Q5NK4RncA==/109951168806948253.jpg"},{"name":"重生——《灵笼》","artist":"米浆mota","url":"https://dragon-xjy.gitee.io/resource/blog/obj_w5zDlMODwrDDiGjCn8Ky_2086216499_2338_e317_d2b4_8d00116ac5b5c8af88b46aa6840bd52f.mp3","cover":"https://p1.music.126.net/AZDJY7oNuxD_A910XCJeGw==/109951164349143568.jpg?param=130y130"}]},"mermaid":{"enable":false,"version":"9.3.0"}},"version":"2.4.4","navbar":{"auto_hide":true,"color":{"left":"#f78736","right":"#367df7","transparency":10},"article":{"Article":{"icon":"fa-solid fa-folder","path":"/article/"}},"tags":{"Tags":{"icon":"fa-solid fa-tags","path":"/tags/"}},"categories":{"Categories":{"icon":"fa-solid fa-folder","path":"/categories/"}},"links":{"首页":{"path":"/","icon":"fa-regular fa-house"},"网页素材":{"path":"/photo","icon":"fa-solid fa-image"},"归档":{"icon":"fa-regular fa-archive","submenus":{"时间轴":"/archives","标签":"/tags","文章分类":"/categories"}},"友情链接":{"path":"/links/","icon":"fa-solid fa-link"}},"search":{"enable":true,"preload":true}},"page_templates":{"friends_column":2,"tags_style":"blur"},"home":{"sidebar":{"enable":true,"position":"left","first_item":"menu","announcement":null,"links":{"Archives":{"path":"/archives","icon":"fa-regular fa-archive"},"Tags":{"path":"/tags","icon":"fa-regular fa-tags"},"Categories":{"path":"/categories","icon":"fa-regular fa-folder"}}},"article_date_format":"auto","categories":{"enable":true,"limit":3},"tags":{"enable":true,"limit":3}},"footerStart":"2023/8/25 8:45:14"};
    Global.language_ago = {"second":"%s 秒前","minute":"%s 分钟前","hour":"%s 小时前","day":"%s 天前","week":"%s 周前","month":"%s 个月前","year":"%s 年前"};
    Global.data_config = {"masonry":true};
  </script>
    
    <!--- Fontawesome Part-->
    
<link rel="stylesheet" href="/personal/fontawesome/fontawesome.min.css">

    
<link rel="stylesheet" href="/personal/fontawesome/brands.min.css">

    
<link rel="stylesheet" href="/personal/fontawesome/solid.min.css">

    
<link rel="stylesheet" href="/personal/fontawesome/regular.min.css">

    
    
    
    
<meta name="generator" content="Hexo 6.3.0"></head>


<body>
<div class="progress-bar-container">
    

    
        <span class="pjax-progress-bar"></span>
        <span class="swup-progress-icon">
            <i class="fa-solid fa-circle-notch fa-spin"></i>
        </span>
    
</div>


<main class="page-container" id="swup">

    

    <div class="main-content-container">


        <div class="main-content-header">
            <header class="navbar-container">
    
    <div class="navbar-content">
        <div class="left">
            
            <a class="logo-title" href="https://dragon-xjy.atomgit.net/personal/">
                
                XieJinYangの博客
                
            </a>
        </div>

        <div class="right">
            <!-- PC -->
            <div class="desktop">
                <ul class="navbar-list">
                    
                        
                            <li class="navbar-item">
                                <!-- Menu -->
                                <a class="" 
                                    href="/personal/"  >
                                    
                                        
                                            <i class="fa-regular fa-house"></i>
                                        
                                        首页
                                    
                                </a>
                                <!-- Submenu -->
                                
                            </li>
                    
                        
                            <li class="navbar-item">
                                <!-- Menu -->
                                <a class="" 
                                    href="/personal/photo"  >
                                    
                                        
                                            <i class="fa-solid fa-image"></i>
                                        
                                        网页素材
                                    
                                </a>
                                <!-- Submenu -->
                                
                            </li>
                    
                        
                            <li class="navbar-item">
                                <!-- Menu -->
                                <a class="has-dropdown" 
                                    href="#" onClick="return false;">
                                    
                                        
                                            <i class="fa-regular fa-archive"></i>
                                        
                                        归档&nbsp;<i class="fa-solid fa-chevron-down"></i>
                                    
                                </a>
                                <!-- Submenu -->
                                
                                    <ul class="sub-menu">
                                    
                                        <li>
                                        <a href="/personal/archives">时间轴
                                        </a>
                                        </li>
                                    
                                        <li>
                                        <a href="/personal/tags">标签
                                        </a>
                                        </li>
                                    
                                        <li>
                                        <a href="/personal/categories">文章分类
                                        </a>
                                        </li>
                                    
                                    </ul>
                                
                            </li>
                    
                        
                            <li class="navbar-item">
                                <!-- Menu -->
                                <a class="" 
                                    href="/personal/links/"  >
                                    
                                        
                                            <i class="fa-solid fa-link"></i>
                                        
                                        友情链接
                                    
                                </a>
                                <!-- Submenu -->
                                
                            </li>
                    
                    
                        <li class="navbar-item search search-popup-trigger">
                            <i class="fa-solid fa-magnifying-glass"></i>
                        </li>
                    
                </ul>
            </div>
            <!-- Mobile -->
            <div class="mobile">
                
                    <div class="icon-item search search-popup-trigger"><i class="fa-solid fa-magnifying-glass"></i></div>
                
                <div class="icon-item navbar-bar">
                    <div class="navbar-bar-middle"></div>
                </div>
            </div>
        </div>
    </div>

    <!-- Mobile drawer -->
    <div class="navbar-drawer w-full absolute top-0 left-0 bg-background-color">
        <ul class="drawer-navbar-list flex flex-col justify-start items-center">
            
                
                    <li class="drawer-navbar-item text-base my-1.5 flex justify-center items-center">
                        <a class="rounded-3xl py-1.5 px-5 hover:border hover:!text-primary active:!text-primary group " 
                        href="/personal/"  >
                             
                                
                                    <i class="fa-regular fa-house"></i>
                                
                                首页
                            
                        </a>
                    </li>
                    <!-- Submenu -->
                    
            
                
                    <li class="drawer-navbar-item text-base my-1.5 flex justify-center items-center">
                        <a class="rounded-3xl py-1.5 px-5 hover:border hover:!text-primary active:!text-primary group " 
                        href="/personal/photo"  >
                             
                                
                                    <i class="fa-solid fa-image"></i>
                                
                                网页素材
                            
                        </a>
                    </li>
                    <!-- Submenu -->
                    
            
                
                    <li class="drawer-navbar-item text-base my-1.5 flex justify-center items-center">
                        <a class="rounded-3xl py-1.5 px-5 hover:border hover:!text-primary active:!text-primary group has-dropdown" 
                        href="#" onClick="return false;">
                            
                                
                                    <i class="fa-regular fa-archive"></i>
                                
                                归档&nbsp;<i class="group-hover:rotate-180 transition-transform fa-solid fa-chevron-down"></i>
                            
                        </a>
                    </li>
                    <!-- Submenu -->
                              
                        
                            <li class="text-base flex justify-center items-center hover:underline active:underline hover:underline-offset-1 rounded-3xl">
                                <a class="py-0.5" href="/personal/archives">时间轴</a>
                            </li>
                        
                            <li class="text-base flex justify-center items-center hover:underline active:underline hover:underline-offset-1 rounded-3xl">
                                <a class="py-0.5" href="/personal/tags">标签</a>
                            </li>
                        
                            <li class="text-base flex justify-center items-center hover:underline active:underline hover:underline-offset-1 rounded-3xl">
                                <a class="py-0.5" href="/personal/categories">文章分类</a>
                            </li>
                        
                    
            
                
                    <li class="drawer-navbar-item text-base my-1.5 flex justify-center items-center">
                        <a class="rounded-3xl py-1.5 px-5 hover:border hover:!text-primary active:!text-primary group " 
                        href="/personal/links/"  >
                             
                                
                                    <i class="fa-solid fa-link"></i>
                                
                                友情链接
                            
                        </a>
                    </li>
                    <!-- Submenu -->
                    
            

        </ul>
    </div>

    <div class="window-mask"></div>

</header>


        </div>

        <div class="main-content-body">

            

            <div class="main-content">

                
                    <div class="post-page-container">
    <div class="article-content-container">

        <div class="article-title">
            
                <h1 class="article-title-regular">简单又实用的CSS小技巧！</h1>
            
            </div>
            
                    
        
        
            <div class="article-header">
                <div class="avatar">
                    <img src="https://dragon-xjy.gitee.io/resource/blog/logo.jpg">
                </div>
                <div class="info">
                    <div class="author">
                        <span class="name">The局外人</span>
                        
                            <span class="author-label">Lv Max</span>
                        
                    </div>
                    <div class="meta-info">
                        <div class="article-meta-info">
    <span class="article-date article-meta-item">
        <i class="fa-regular fa-pen-fancy"></i>&nbsp;
        <span class="desktop">2024-05-14 11:43:01</span>
        <span class="mobile">2024-05-14 11:43:01</span>
        <span class="hover-info">创建</span>
    </span>
    
        <span class="article-date article-meta-item">
            <i class="fa-regular fa-wrench"></i>&nbsp;
            <span class="desktop">2023-09-03 22:18:25</span>
            <span class="mobile">2023-09-03 22:18:25</span>
            <span class="hover-info">更新</span>
        </span>
    

    
        <span class="article-categories article-meta-item">
            <i class="fa-regular fa-folders"></i>&nbsp;
            <ul>
                
                
                    
                        
                        <li>
                            <a href="/personal/categories/CSS%E6%8A%80%E5%B7%A7/">CSS技巧</a>&nbsp;
                        </li>
                    
                    
                
            </ul>
        </span>
    
    
        <span class="article-tags article-meta-item">
            <i class="fa-regular fa-tags"></i>&nbsp;
            <ul>
                
                    <li>
                        <a href="/personal/tags/%E5%89%8D%E7%AB%AF/">前端</a>&nbsp;
                    </li>
                
                    <li>
                        | <a href="/personal/tags/CSS/">CSS</a>&nbsp;
                    </li>
                
                    <li>
                        | <a href="/personal/tags/%E5%AE%9E%E7%94%A8/">实用</a>&nbsp;
                    </li>
                
            </ul>
        </span>
    

    
    
    
    
        <span class="article-pv article-meta-item">
            <i class="fa-regular fa-eye"></i>&nbsp;<span id="busuanzi_value_page_pv"></span>
        </span>
    
</div>

                    </div>
                </div>
            </div>
        

        


        <div class="article-content markdown-body">
            <p>CSS是<strong>网页设计</strong>的重要组成部分，负责网页的样式和布局， 大约有上百个属性，本文分享一些有用的 CSS 小技巧，方便开发者和设计师参考，一起来看看吧~~~</p>
<h2 id="firlter用法"><a href="#firlter用法" class="headerlink" title="firlter用法"></a>firlter用法</h2><p>filter(<strong>滤镜</strong>)通常用于调整图像、背景和边框的渲染。</p>
<h3 id="图片置灰"><a href="#图片置灰" class="headerlink" title="图片置灰"></a>图片置灰</h3><div class="highlight-container" data-rel="Javascript"><figure class="iseeu highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">filter</span>: <span class="title function_">grayscale</span>(<span class="number">100</span>%);</span><br></pre></td></tr></table></figure></div>
<p><img  
                     lazyload
                     src="/images/loading.svg"
                     data-src="/personal/image/css/image1.png"
                      alt="image.png"
                ></p>
<h3 id="滤镜阴影"><a href="#滤镜阴影" class="headerlink" title="滤镜阴影"></a>滤镜阴影</h3><div class="highlight-container" data-rel="Javascript"><figure class="iseeu highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">filter</span>: drop-<span class="title function_">shadow</span>(10px 10px 10px <span class="title function_">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">0.8</span>));</span><br></pre></td></tr></table></figure></div>
<p>大多数人都知道<code>box-shadow: 10px 10px 10px rgba(0, 0, 0, 0.8);</code>是设置盒子阴影，但你知道<code> filter: drop-shadow</code>与<code>box-shadow</code>的区别吗？<br>举个例子：</p>
<div class="highlight-container" data-rel="Javascript"><figure class="iseeu highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">&lt;style&gt;</span><br><span class="line">    .<span class="property">img1</span> &#123;</span><br><span class="line">        <span class="attr">filter</span>: drop-<span class="title function_">shadow</span>(10px 10px 10px <span class="title function_">rgba</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0.8</span>));</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .<span class="property">img2</span> &#123;</span><br><span class="line">        box-<span class="attr">shadow</span>: 10px 10px 10px <span class="title function_">rgba</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0.8</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&lt;/style&gt;</span><br><span class="line"></span><br><span class="line">&lt;body&gt;</span><br><span class="line">    &lt;img class=&quot;img1&quot; style=&quot;width: 200px;height: 180px; margin: 100px;&quot; src=&quot;./img/huanbg.png&quot;&gt;</span><br><span class="line">    &lt;img class=&quot;img2&quot; style=&quot;width: 200px;height: 180px; margin: 100px;&quot; src=&quot;./img/huanbg.png&quot;&gt;</span><br><span class="line">&lt;/body&gt;</span><br></pre></td></tr></table></figure></div>
<p>这里列举了两种情况：<br><img  
                     lazyload
                     src="/images/loading.svg"
                     data-src="/personal/image/css/image2.png"
                      alt="image.png"
                ><br>不难看出区别显而易见，但值的注意的是这种情况只针对一张<strong>无背景的图片。</strong></p>
<h3 id="模糊图片"><a href="#模糊图片" class="headerlink" title="模糊图片"></a>模糊图片</h3><div class="highlight-container" data-rel="Javascript"><figure class="iseeu highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//数值越高越模糊</span></span><br><span class="line"><span class="attr">filter</span>: <span class="title function_">blur</span>(5px);</span><br></pre></td></tr></table></figure></div>
<p>对比图：<br><img  
                     lazyload
                     src="/images/loading.svg"
                     data-src="/personal/image/css/image3.png"
                      alt="image.png"
                ></p>
<h2 id="Cursor"><a href="#Cursor" class="headerlink" title="Cursor"></a>Cursor</h2><p><strong>cursor</strong> <a class="link"   target="_blank" rel="noopener" href="https://developer.mozilla.org/zh-CN/docs/Web/CSS" >CSS</a> 属性设置光标的类型（如果有），在鼠标指针悬停在元素上时显示相应样式。</p>
<div class="highlight-container" data-rel="Javascript"><figure class="iseeu highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">cursor</span>:<span class="keyword">default</span><span class="comment">//默认箭头</span></span><br><span class="line"><span class="attr">cursor</span>:pointer<span class="comment">//小手</span></span><br><span class="line"><span class="attr">cursor</span>:not-allowed<span class="comment">//禁用标志</span></span><br><span class="line"><span class="attr">cursor</span>:grab<span class="comment">//可抓取</span></span><br><span class="line">等等</span><br></pre></td></tr></table></figure></div>
<p>自定义光标样式，通过url可以自定义样式我查阅相关文档，发现最适合设置鼠标样式的文件为<code>.cur</code>和<code>.gif</code>但都没生效用<code>.ico</code>就成功了<br>这是网址 <a class="link"   target="_blank" rel="noopener" href="https://convertio.co/zh/png-cur/" >https://convertio.co/zh/png-cur/</a></p>
<div class="highlight-container" data-rel="Javascript"><figure class="iseeu highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//这里default是当图片没加载出来时候显示默认光标</span></span><br><span class="line">body &#123;</span><br><span class="line">  <span class="attr">width</span>: <span class="number">100</span>%;</span><br><span class="line">  <span class="attr">height</span>: 100vh;</span><br><span class="line">  <span class="attr">cursor</span>: <span class="title function_">url</span>(<span class="string">&quot;./img/bitbug_favicon.ico&quot;</span>),<span class="keyword">default</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure></div>
<p><img  
                     lazyload
                     src="/images/loading.svg"
                     data-src="/personal/image/css/image4.png"
                      alt="Snipaste_2023-09-02_15-00-03.png"
                ><br>如制作游戏网页可以这样</p>
<h2 id="超出文本省略号"><a href="#超出文本省略号" class="headerlink" title="超出文本省略号"></a>超出文本省略号</h2><h3 id="单行文本"><a href="#单行文本" class="headerlink" title="单行文本"></a>单行文本</h3><div class="highlight-container" data-rel="Css"><figure class="iseeu highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">overflow</span>:hidden;<span class="comment">/*超出部分隐藏*/</span></span><br><span class="line"><span class="attribute">text-overflow</span>:ellipsis;<span class="comment">/*超出部分显示省略号*/</span></span><br><span class="line"><span class="attribute">white-space</span>:nowrap;<span class="comment">/*规定段落中的文本不进行换行 */</span></span><br></pre></td></tr></table></figure></div>
<h3 id="多行文本"><a href="#多行文本" class="headerlink" title="多行文本"></a>多行文本</h3><div class="highlight-container" data-rel="Css"><figure class="iseeu highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">overflow</span>: hidden;</span><br><span class="line"><span class="attribute">display</span>: -webkit-box;   //将对象作为弹性伸缩盒子模型显示  </span><br><span class="line">-webkit-box-orient: vertical;   //设置伸缩盒对象的子元素的排列方式 </span><br><span class="line">-webkit-line-clamp: <span class="number">3</span>;   //用来限制在一个块元素中显示的文本的行数</span><br><span class="line"><span class="attribute">word-break</span>: break-all;   //让浏览器实现在任意位置的换行 *break-<span class="attribute">all</span>为允许在单词内换行*</span><br></pre></td></tr></table></figure></div>
<h2 id="其他"><a href="#其他" class="headerlink" title="其他"></a>其他</h2><h3 id="input光标颜色"><a href="#input光标颜色" class="headerlink" title="input光标颜色"></a>input光标颜色</h3><div class="highlight-container" data-rel="Css"><figure class="iseeu highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">input</span>&#123;</span><br><span class="line">  <span class="attribute">caret-color</span>: red;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></div>
<h3 id="画一个太阳"><a href="#画一个太阳" class="headerlink" title="画一个太阳"></a>画一个太阳</h3><div class="highlight-container" data-rel="Css"><figure class="iseeu highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">div</span> &#123;</span><br><span class="line">  <span class="attribute">width</span>: <span class="number">300px</span>;</span><br><span class="line">  <span class="attribute">height</span>: <span class="number">300px</span>;</span><br><span class="line">  <span class="attribute">background-color</span>: yellow;</span><br><span class="line">  <span class="attribute">border-radius</span>: <span class="number">50%</span>;</span><br><span class="line">  <span class="attribute">box-shadow</span>: <span class="number">0</span> <span class="number">0</span> <span class="number">60px</span> <span class="number">60px</span> inset <span class="built_in">rgba</span>(<span class="number">225</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0.7</span>);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></div>
<p><img  
                     lazyload
                     src="/images/loading.svg"
                     data-src="/personal/image/css/image5.png"
                      alt="image.png"
                ></p>
<h2 id="最后"><a href="#最后" class="headerlink" title="最后"></a>最后</h2><p>以上就是一些开发中可能会用到的技巧，后续我还会总结出更多实用小技巧！！！</p>

        </div>

        
            <div class="post-copyright-info">
                <div class="article-copyright-info-container">
    <ul>
        <li><strong>标题:</strong> 简单又实用的CSS小技巧！</li>
        <li><strong>作者:</strong> The局外人</li>
        <li><strong>创建于
                :</strong> 2024-05-14 11:43:01</li>
        
            <li>
                <strong>更新于
                    :</strong> 2023-09-03 22:18:25
            </li>
        
        <li>
            <strong>链接:</strong> https://dragon-xjy.gitee.io/2024/05/14/简单又实用的CSS小技巧/
        </li>
        <li>
            <strong>
                版权声明:
            </strong>
            
            本文章采用 <a class="license" target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">CC BY-NC-SA 4.0</a> 进行许可。
            

        </li>
    </ul>
</div>

            </div>
        

        
            <ul class="post-tags-box">
                
                    <li class="tag-item">
                        <a href="/personal/tags/%E5%89%8D%E7%AB%AF/">#前端</a>&nbsp;
                    </li>
                
                    <li class="tag-item">
                        <a href="/personal/tags/CSS/">#CSS</a>&nbsp;
                    </li>
                
                    <li class="tag-item">
                        <a href="/personal/tags/%E5%AE%9E%E7%94%A8/">#实用</a>&nbsp;
                    </li>
                
            </ul>
        

        

        
            <div class="article-nav">
                
                    <div class="article-prev">
                        <a class="prev"
                        rel="prev"
                        href="/personal/2024/05/15/uniapp%E6%89%93%E5%8C%85App%E5%AF%BC%E5%87%BAxlsx/"
                        >
                            <span class="left arrow-icon flex justify-center items-center">
                                <i class="fa-solid fa-chevron-left"></i>
                            </span>
                            <span class="title flex justify-center items-center">
                                <span class="post-nav-title-item">uniapp打包App实现导出xlsx</span>
                                <span class="post-nav-item">上一篇</span>
                            </span>
                        </a>
                    </div>
                
                
                    <div class="article-next">
                        <a class="next"
                        rel="next"
                        href="/personal/2024/05/14/%E9%80%9A%E4%BF%97%E6%98%93%E6%87%82%E4%B9%8BPromise/"
                        >
                            <span class="title flex justify-center items-center">
                                <span class="post-nav-title-item">通俗易懂之Promise!</span>
                                <span class="post-nav-item">下一篇</span>
                            </span>
                            <span class="right arrow-icon flex justify-center items-center">
                                <i class="fa-solid fa-chevron-right"></i>
                            </span>
                        </a>
                    </div>
                
            </div>
        


        
            <div class="comment-container">
                <div class="comments-container pjax">
    <div id="comment-anchor"></div>
    <div class="comment-area-title">
        <i class="fa-solid fa-comments"></i>&nbsp;评论
    </div>
    

        
            
 
    <div id="waline"></div>
    <script type="module"  data-swup-reload-script>
        import { init } from 'https://evan.beee.top/js/waline.mjs';

        function loadWaline() {
            init({
                el: '#waline',
                serverURL: 'https://waline-xjy-blog.oknice.ca/',
                lang: 'zh-CN',
                dark: 'body[class~="dark-mode"]',
                requiredMeta: ['nick','mail'], // cannot customize by theme config, change it yourself
            });
        }

        if ('true') {
            const loadWalineTimeout = setTimeout(() => {
                loadWaline();
                clearTimeout(loadWalineTimeout);
            }, 1000);
        } else {
            window.addEventListener('DOMContentLoaded', loadWaline);
        }
        
    </script>



        
    
</div>

            </div>
        
    </div>

    
        <div class="toc-content-container">
            <div class="post-toc-wrap">
    <div class="post-toc">
        <div class="toc-title">此页目录</div>
        <div class="page-title">简单又实用的CSS小技巧！</div>
        <ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#firlter%E7%94%A8%E6%B3%95"><span class="nav-number">1.</span> <span class="nav-text">firlter用法</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%9B%BE%E7%89%87%E7%BD%AE%E7%81%B0"><span class="nav-number">1.1.</span> <span class="nav-text">图片置灰</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%BB%A4%E9%95%9C%E9%98%B4%E5%BD%B1"><span class="nav-number">1.2.</span> <span class="nav-text">滤镜阴影</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%A8%A1%E7%B3%8A%E5%9B%BE%E7%89%87"><span class="nav-number">1.3.</span> <span class="nav-text">模糊图片</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Cursor"><span class="nav-number">2.</span> <span class="nav-text">Cursor</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%B6%85%E5%87%BA%E6%96%87%E6%9C%AC%E7%9C%81%E7%95%A5%E5%8F%B7"><span class="nav-number">3.</span> <span class="nav-text">超出文本省略号</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%8D%95%E8%A1%8C%E6%96%87%E6%9C%AC"><span class="nav-number">3.1.</span> <span class="nav-text">单行文本</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%A4%9A%E8%A1%8C%E6%96%87%E6%9C%AC"><span class="nav-number">3.2.</span> <span class="nav-text">多行文本</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%85%B6%E4%BB%96"><span class="nav-number">4.</span> <span class="nav-text">其他</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#input%E5%85%89%E6%A0%87%E9%A2%9C%E8%89%B2"><span class="nav-number">4.1.</span> <span class="nav-text">input光标颜色</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%94%BB%E4%B8%80%E4%B8%AA%E5%A4%AA%E9%98%B3"><span class="nav-number">4.2.</span> <span class="nav-text">画一个太阳</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%9C%80%E5%90%8E"><span class="nav-number">5.</span> <span class="nav-text">最后</span></a></li></ol>

    </div>
</div>
        </div>
    
</div>



                

            </div>

            

        </div>

        <div class="main-content-footer">
            <footer class="footer mt-5 py-5 h-auto text-base text-third-text-color relative border-t-2 border-t-border-color">
    <div class="info-container py-3 text-center">
        
        <div class="text-center">
            &copy;
            
              <span>2023</span>
              -
            
            2024&nbsp;&nbsp;<i class="fa-solid fa-heart fa-beat" style="--fa-animation-duration: 0.5s; color: #f54545"></i>&nbsp;&nbsp;<a href="/">The局外人</a>
        </div>
        
            <script data-swup-reload-script src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
            <div class="relative text-center lg:absolute lg:right-[20px] lg:top-1/2 lg:-translate-y-1/2 lg:text-right">
                
                    <span id="busuanzi_container_site_uv" class="lg:!block">
                        <span class="text-sm">访问人数</span>
                        <span id="busuanzi_value_site_uv"></span>
                    </span>
                
                
                    <span id="busuanzi_container_site_pv" class="lg:!block">
                        <span class="text-sm">总访问量</span>
                        <span id="busuanzi_value_site_pv"></span>
                    </span>
                
            </div>
        
        <div class="relative text-center lg:absolute lg:left-[20px] lg:top-1/2 lg:-translate-y-1/2 lg:text-left">
            <span class="lg:block text-sm">由 <?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="relative top-[2px] inline-block align-baseline" version="1.1" id="圖層_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1rem" height="1rem" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"><path fill="#0E83CD" d="M256.4,25.8l-200,115.5L56,371.5l199.6,114.7l200-115.5l0.4-230.2L256.4,25.8z M349,354.6l-18.4,10.7l-18.6-11V275H200v79.6l-18.4,10.7l-18.6-11v-197l18.5-10.6l18.5,10.8V237h112v-79.6l18.5-10.6l18.5,10.8V354.6z"/></svg><a target="_blank" class="text-base" href="https://hexo.io">Hexo</a> 驱动</span>
            <span class="text-sm lg:block">主题&nbsp;<a class="text-base" target="_blank" href="https://github.com/EvanNotFound/hexo-theme-redefine">Redefine v2.4.4</a></span>
        </div>
        
        
            <div>
                博客已运行 <span class="odometer" id="runtime_days" ></span> 天 <span class="odometer" id="runtime_hours"></span> 小时 <span class="odometer" id="runtime_minutes"></span> 分钟 <span class="odometer" id="runtime_seconds"></span> 秒
            </div>
        
        
            <script data-swup-reload-script>
                try {
                    function odometer_init() {
                    const elements = document.querySelectorAll('.odometer');
                    elements.forEach(el => {
                        new Odometer({
                            el,
                            format: '( ddd).dd',
                            duration: 200
                        });
                    });
                    }
                    odometer_init();
                } catch (error) {}
            </script>
        
        
        
    </div>  
</footer>
        </div>
    </div>

    
        <div class="post-tools">
            <div class="post-tools-container">
    <ul class="article-tools-list">
        <!-- TOC aside toggle -->
        
            <li class="right-bottom-tools page-aside-toggle">
                <i class="fa-regular fa-outdent"></i>
            </li>
        

        <!-- go comment -->
        
            <li class="go-comment">
                <i class="fa-regular fa-comments"></i>
            </li>
        
    </ul>
</div>

        </div>
    

    <div class="right-side-tools-container">
        <div class="side-tools-container">
    <ul class="hidden-tools-list">
        <li class="right-bottom-tools tool-font-adjust-plus flex justify-center items-center">
            <i class="fa-regular fa-magnifying-glass-plus"></i>
        </li>

        <li class="right-bottom-tools tool-font-adjust-minus flex justify-center items-center">
            <i class="fa-regular fa-magnifying-glass-minus"></i>
        </li>

        <li class="right-bottom-tools tool-expand-width flex justify-center items-center">
            <i class="fa-regular fa-expand"></i>
        </li>

        <li class="right-bottom-tools tool-dark-light-toggle flex justify-center items-center">
            <i class="fa-regular fa-moon"></i>
        </li>

        <!-- rss -->
        

        

        <li class="right-bottom-tools tool-scroll-to-bottom flex justify-center items-center">
            <i class="fa-regular fa-arrow-down"></i>
        </li>
    </ul>

    <ul class="visible-tools-list">
        <li class="right-bottom-tools toggle-tools-list flex justify-center items-center">
            <i class="fa-regular fa-cog fa-spin"></i>
        </li>
        
            <li class="right-bottom-tools tool-scroll-to-top flex justify-center items-center">
                <i class="arrow-up fas fa-arrow-up"></i>
                <span class="percent"></span>
            </li>
        
        
    </ul>
</div>

    </div>

    <div class="image-viewer-container">
    <img src="">
</div>


    
        <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
          <span class="search-input-field-pre">
            <i class="fa-solid fa-keyboard"></i>
          </span>
            <div class="search-input-container">
                <input autocomplete="off"
                       autocorrect="off"
                       autocapitalize="off"
                       placeholder="搜索..."
                       spellcheck="false"
                       type="search"
                       class="search-input"
                >
            </div>
            <span class="popup-btn-close">
                <i class="fa-solid fa-times"></i>
            </span>
        </div>
        <div id="search-result">
            <div id="no-result">
                <i class="fa-solid fa-spinner fa-spin-pulse fa-5x fa-fw"></i>
            </div>
        </div>
    </div>
</div>

    

</main>


    
<script src="/personal/js/libs/Swup.min.js"></script>

<script src="/personal/js/libs/SwupSlideTheme.min.js"></script>

<script src="/personal/js/libs/SwupScriptsPlugin.min.js"></script>

<script src="/personal/js/libs/SwupProgressPlugin.min.js"></script>

<script src="/personal/js/libs/SwupScrollPlugin.min.js"></script>

<script>
    const swup = new Swup({
        plugins: [
            new SwupScriptsPlugin({
                optin: true,
            }),
            new SwupProgressPlugin(),
            new SwupScrollPlugin({
                offset: 80,
            }),
            new SwupSlideTheme({
                mainElement: ".main-content-body",
            }),
        ],
        containers: ["#swup"],
    });

    swup.hooks.on("page:view", () => {
        Global.refresh();
    });

    // if (document.readyState === "complete") {
    //
    // } else {
    //     document.addEventListener("DOMContentLoaded", () => init());
    // }
</script>






<script src="/personal/js/utils.js" type="module"></script>

<script src="/personal/js/main.js" type="module"></script>

<script src="/personal/js/layouts/navbarShrink.js" type="module"></script>

<script src="/personal/js/tools/scrollTopBottom.js" type="module"></script>

<script src="/personal/js/tools/lightDarkSwitch.js" type="module"></script>

<script src="/personal/js/layouts/categoryList.js" type="module"></script>



    
<script src="/personal/js/tools/localSearch.js"></script>




    
<script src="/personal/js/tools/codeBlock.js"></script>




    
<script src="/personal/js/layouts/lazyload.js"></script>




    
<script src="/personal/js/tools/runtime.js"></script>

    
<script src="/personal/js/libs/odometer.min.js"></script>

    
<link rel="stylesheet" href="/personal/assets/odometer-theme-minimal.css">




  
<script src="/personal/js/libs/Typed.min.js"></script>

  
<script src="/personal/js/plugins/typed.js"></script>






    
<script src="/personal/js/libs/minimasonry.min.js"></script>

    
<script src="/personal/js/plugins/masonry.js" type="module"></script>




<div class="post-scripts" data-swup-reload-script>
    
        
<script src="/personal/js/libs/anime.min.js"></script>

        
<script src="/personal/js/tools/tocToggle.js" type="module"></script>

<script src="/personal/js/layouts/toc.js" type="module"></script>

<script src="/personal/js/plugins/tabs.js" type="module"></script>

    
</div>


    <div id="aplayer"></div>

<script src="/personal/js/libs/APlayer.min.js"></script>


<script src="/personal/js/plugins/aplayer.js"></script>


</body>
</html>
